package dao.oc_property_ice;
import java.util.ArrayList;
import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import entitybean.oc_property_ice.EntityBean_Oc_Property_Ice;
public class DaoImpl_Oc_Property_Ice  extends HibernateDaoSupport implements Dao_Oc_Property_Ice{
	public void Insert_Oc_Property_Ice(EntityBean_Oc_Property_Ice e) {
		this.getHibernateTemplate().save(e);
	}

	public void Update_Oc_Property_Ice(EntityBean_Oc_Property_Ice e) {
		this.getHibernateTemplate().update(e);
	}

	@SuppressWarnings("unchecked")
	public void Delete_Oc_Property_Ice(String id) {
		List<EntityBean_Oc_Property_Ice> list=this.getHibernateTemplate().find("from EntityBean_Oc_Property_Ice where del='OFF' and id in("+id+")");	
		for(int i=0;i<list.size();i++)
		{
			EntityBean_Oc_Property_Ice e=list.get(i);
			e.setDel("ON");
			this.getHibernateTemplate().update(e);
			
		}
	}

	@SuppressWarnings("unchecked")
	public EntityBean_Oc_Property_Ice Find_EntityBean_Oc_Property_Ice(Integer id) {
		EntityBean_Oc_Property_Ice e=new EntityBean_Oc_Property_Ice();
		List<EntityBean_Oc_Property_Ice> list=this.getHibernateTemplate().find("from EntityBean_Oc_Property_Ice where id="+id);
		if(list.size()>0)
		{
			e=list.get(0);
		}
		return e;
	}
	
	@SuppressWarnings("unchecked")
	public List<EntityBean_Oc_Property_Ice> Find_EntityBean_Oc_Property_Ice_by_property_kind(
			Integer id) {
		return this.getHibernateTemplate().find(
				"from EntityBean_Oc_Property_Ice where kind_id=" + id
						+ " and del='OFF'");

	}
	@SuppressWarnings("unchecked")
	public List<EntityBean_Oc_Property_Ice> Find_EntityBean_Oc_Property_Ice() {
		List<EntityBean_Oc_Property_Ice> list=new ArrayList<EntityBean_Oc_Property_Ice>();
		list=this.getHibernateTemplate().find("from EntityBean_Oc_Property_Ice where del='OFF' ");
		return list;
	}
	
	

}
